while ((line = readline())) {
  let flag = false
  let arr = line.split(' ')
  if (arr.includes('joker') || arr.includes('JOKER')) {
    console.log('ERROR')
    continue
  }

  let tArr = arr.map((item) => {
    if (item === 'J') {
      return 11
    } else if (item === 'Q') {
      return 12
    } else if (item === 'K') {
      return 13
    } else if (item === 'A') {
      return 1
    } else {
      return Number(item)
    }
  })

  let numArr = nArrangement(tArr)
  let operate = ['-', '+', '*', '/']
  let opArr = arrangement(operate)

  numArr.forEach((num) => {
    opArr.forEach((op) => {
      let res = num[0]
      for (let i = 0; i < 3; i++) {
        switch (op[i]) {
          case '+':
            res += num[i + 1]
            break
          case '-':
            res -= num[i + 1]
            break
          case '*':
            res *= num[i + 1]
            break
          case '/':
            res = (res - (res % num[i + 1])) / num[i + 1]
            break
        }
      }
      if (res === 24 && !flag) {
        num = num.map((item) => {
          if (item === 11) {
            return 'J'
          } else if (item === 12) {
            return 'Q'
          } else if (item === 13) {
            return 'K'
          } else if (item === 1) {
            return 'A'
          } else {
            return parseInt(item)
          }
        })
        console.log(
          `${num[0]}${op[0]}${num[1]}${op[1]}${num[2]}${op[2]}${num[3]}`
        )
        flag = true
      }
    })
  })

  if (!flag) {
    console.log('NONE')
  }
}

function arrangement(arr) {
  let result = []
  arr.forEach((item1) => {
    arr.forEach((item2) => {
      arr.forEach((item3) => {
        result.push([item1, item2, item3])
      })
    })
  })
  return result
}
function nArrangement(arr) {
  if (arr.length === 1) return [[arr[0]]]
  let result = []
  arr.forEach((item, index) => {
    let other = arr.slice(0, index).concat(arr.slice(index + 1))
    nArrangement(other).forEach((nextItem) => {
      result.push(nextItem.concat([item]))
    })
  })
  return result
}
